home *** CD-ROM | disk | FTP | other *** search
- GRAPHIC.DOC 11/15/91 Copyright (c) 1991 by James S. Clark
- ==========================================================================
- GRAPHIC
- Graphic Class
- --------------------------------------------------------------------------
- Class Name Graphic
- Superclass <none>
- Category Graphics
- Other classes referenced <none>
- Other catagories referenced <none>
- Used by many
- Inherited by <none>
-
- Declaration Graphic graph;
-
- Instance Variables
- int graphdriver, graphmode;
- int screenwidth, screenheight;
- int fontwidth, fontheight;
- int color, pattern;
- Instance Methods
- Graphic (int driver = DETECT, int mode = 0);
- Graphic();
- ~Graphic();
- void backcolor (int );
- void clear ( );
- void drawchar (char );
- void drawstring(int , int , char *);
- void fillarc (int , int , int , int ,
- int , int );
- void filloval (int , int , int , int );
- void fillpolygon(int , int far *);
- void fillrect (int , int , int , int );
- void framearc (int , int , int , int ,
- int , int );
- void framepolygon(int , int far *);
- void framerect (int , int , int , int );
- void frameoval (int , int , int , int );
- void line_rel (int , int );
- void line_to (int , int );
- void move_rel (int , int );
- void move_to (int , int );
- void pencolor (int );
- void penpattern(int );
- int readpixel (int , int );
- void screensize(int *, int *);
- void setpixel (int , int , int );
- void textsize (int *, int *);
- void viewport (int , int , int , int );
- void shutdown ();
-
- --------------------------------------------------------------------------
- GENERAL DESCRIPTION
-
- The Graphic Class provides methods for drawing and plotting on the video
- screen using the Borland BGI drivers. This Class simplifies the syntax
- of many of the commands and provides a more consistent interface than the
- standard BGI interface. In addition, the Graphic Class can simplify the
- job of porting to another dialect of C++ by providing configurable hooks
- into the graphics commands.
-
- --------------------------------------------------------------------------
- VARIABLES
-
- int graphdriver;
- The numeric value of the current BGI driver.
-
- int graphmode;
- The value of the mode of the current driver.
-
- int screenwidth
- Thw width of the screen in pixels.
-
- int screenheight;
- The height of the screen in pixels.
-
- int fontwidth;
- The character width of the selected font.
-
- int fontheight;
- The character height of the current font.
-
- int color;
- The current pen color.
-
- int pattern;
- The current pen and fill pattern.
-
- --------------------------------------------------------------------------
- METHODS
-
- Graphic (int driver = DETECT, int mode = 0);
- Creates and instance of the Graphic Class and initialize the
- BGI driver and display. Defaults to DETECT.
-
- Graphic ();
- Creates and instance of the Graphic Class and initialize the
- BGI driver and display.
-
- ~Graphic();
- Closes down the BGI dirver and destroys the instance.
-
- void backcolor (int color);
- Sets the background color used for filling.
-
- void clear ( );
- Clears the viewport to the background color.
-
- void drawchar (char c);
- Draws a character in the current color at the current pen position.
-
- void drawstring(int x, int y, char *s);
- Draws a string in the current color at the location x, y.
-
- void fillarc (int x, int y, int xr, int yr, int beg, int end);
- Draws an arc filled with the current color and pattern. The
- center is at x,y with a radius of xr,yr from the beg angle to
- the end ang.
-
- void filloval (int x, int y, int xr, int yr);
- Draws an oval filled with the current color and pattern. The
- center is at x,y with a radius of xr,yr.
-
- void fillpolygon(int num, int far *pts);
- Fills a Polygon with the current color and pattern.
-
- void fillrect (int x1, int y1, int x2, int y2);
- Fills a rectangle with the current color and pattern.
-
- void framearc (int , int , int , int , int , int );
- Frames an arc filled with the current color. The center is at
- x,y with a radius of xr,yr from the beg angle to the end ang.
-
- void frameoval (int x, int y, int xr, int yr);
- Frames an oval filled with the current color. The center is at
- x,y with a radius of xr,yr.
-
- void framepolygon(int num, int far *);
- Frames a polygon with the current color.
-
- void framerect (int x1, int y1, int x2, int y2);
- Frames a rectangle in the current color.
-
- void line_rel (int x, int y);
- Draws a line in the current color by moving relative to the
- current position.
-
- void line_to (int x, int y);
- Draws a line from the current position the the absolute screen
- coordinate x,y.
-
- void move_rel (int x, int y);
- Moves the current position relative to the current position,
- but does not draw.
-
- void move_to (int x, int y);
- Move the current position to the absolute screen coordianate.
-
- void pencolor (int );
- Sets the current pen color.
-
- void penpattern(int );
- Sets the current pen pattern.
-
- int readpixel (int x, int y);
- Returns with the color of the pixel at x, y.
-
- void screensize(int *xmax, int *ymax);
- Returns with the values of the screens maximum coordinates.
-
- void setpixel (int x, int y, int c);
- Sets the color of the pixel at x,y to c.
-
- void textsize (int *w, int *h);
- Returns with the width and height of the active font in pixels.
-
- void viewport (int x1, int y1, int x2, int y2);
- Sets the viewport used for drawing. Clips image at the border.
-
- void shutdown ();
- Closes down the BGI driver. Called by ~Graphic().
-
- --------------------------------------------------------------------------
- GRAPHIC.DOC Copyright (c) 1991 by James S. Clark
- ==========================================================================
-